// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity;

import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.*;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.text.TextUtils;
import android.widget.*;
import com.nnee.p_fk.*;
import com.nnee.p_pr.p_app.cls_PrisApp;
import java.io.File;
import java.util.*;

// Referenced classes of package com.nnee.p_pr.p_activity:
//            bx, eb, c, dm

public class cls_SetSkinActivity extends cls_ActivityEx
{

    public cls_SetSkinActivity()
    {
        r = new cls_bx(this, null);
        g = new cls_eb(this);
    }

    static Uri a(cls_SetSkinActivity setskinactivity)
    {
        return setskinactivity.n;
    }

    static Uri a(cls_SetSkinActivity setskinactivity, Uri uri)
    {
        setskinactivity.n = uri;
        return uri;
    }

    private void a(com.nnee.p_fk.cls_l l1)
    {
//        Object obj = null;
//        if(l1 != null && !p.equals(l1.b()) && !TextUtils.isEmpty(l1.b())) goto _L2; else goto _L1
//_L1:
//        String s = p;
//        if(l1 != null)
//            l1.b(p);
//        com.nnee.p_fk.cls_k.a(this).a(l1);
//        com.nnee.p_fk.cls_k.a(this).a(((com.nnee.p_fk.h) (obj)));
//        obj = s;
//_L4:
//        if(obj != null)
//            cls_PrisApp.a().a(((String) (obj)));
//        return;
//_L2:
//        String s1;
//        if(l1.b().matches("internal\\.skin\\..*"))
//        {
//            obj = l1.b();
//            com.nnee.p_fk.cls_k.a(this).a(l1);
//            cls_d d1 = new cls_d(getApplicationContext());
//            com.nnee.p_fk.cls_k.a(this).a(d1);
//            continue; /* Loop/switch isn't completed */
//        }
//        if(!l1.b().matches("pris\\.skin\\..*"))
//            continue; /* Loop/switch isn't completed */
//        s1 = l1.b();
//        com.nnee.p_fk.cls_k.a(this).a(l1);
//        Object obj1 = new cls_f(getApplicationContext(), s1);
//        obj = s1;
//_L5:
//        com.nnee.p_fk.cls_k.a(this).a(((com.nnee.p_fk.h) (obj1)));
//        if(true) goto _L4; else goto _L3
//_L3:
//        android.content.pm.PackageManager.NameNotFoundException namenotfoundexception;
//        namenotfoundexception;
//        namenotfoundexception.printStackTrace();
//        String s2 = p;
//        Object obj2 = obj;
//        obj = s2;
//        obj1 = obj2;
//          goto _L5
    }

    static void a(cls_SetSkinActivity setskinactivity, com.nnee.p_fk.cls_l l1)
    {
        setskinactivity.a(l1);
    }

    static void a(cls_SetSkinActivity setskinactivity, String s)
    {
        setskinactivity.a(s);
    }

    private void a(String s)
    {
        if(!TextUtils.isEmpty(s))
            if(!(new File(s)).exists())
            {
                Toast.makeText(this, "selecte skin package does not exist.", 0).show();
                f();
            } else
            {
                Uri uri = Uri.parse((new StringBuilder()).append("file://").append(s).toString());
                Intent intent = new Intent("android.intent.action.VIEW", uri);
                intent.setDataAndType(uri, "application/vnd.android.package-archive");
                intent.setClassName("com.android.packageinstaller", "com.android.packageinstaller.PackageInstallerActivity");
                startActivity(intent);
            }
    }

    private void a(List list)
    {
//        if(list == null)
//            list = new ArrayList();
//        l l1 = q.f();
//        Iterator iterator;
//        if(l1 != null)
//            list.add(l1);
//        iterator = getPackageManager().getInstalledPackages(8192).iterator();
//        do
//        {
//            if(!iterator.hasNext())
//                break;
//            PackageInfo packageinfo = (PackageInfo)iterator.next();
//            if(packageinfo.packageName.matches("pris\\.skin\\..*"))
//            {
//            	cls_l l2 = q.a(packageinfo.packageName);
//                if(l2 != null)
//                    list.add(l2);
//            }
//        } while(true);
    }

    private void a(List list, String s)
    {
//_L1:
//        return;
//        if(Environment.getExternalStorageState().equals("mounted") && !TextUtils.isEmpty(s) && list != null)
//        {
//            File afile[] = (new File(s)).listFiles();
//            if(afile != null)
//            {
//                PackageManager packagemanager = getPackageManager();
//                int i1 = afile.length;
//                int j1 = 0;
//                while(j1 < i1) 
//                {
//                    File file;
//                    PackageInfo packageinfo;
//label0:
//                    {
//                        file = afile[j1];
//                        if(!file.isFile() || !file.getName().trim().endsWith(".apk"))
//                            break label0;
//                        packageinfo = packagemanager.getPackageArchiveInfo((new StringBuilder()).append(s).append(file.getName().trim()).toString(), 0);
//                    }
//                    if(packageinfo != null && packageinfo.applicationInfo.packageName.matches("pris\\.skin\\..*"))
//                    {
//                        l l1 = q.a((new StringBuilder()).append(s).append(file.getName().trim()).toString(), packagemanager, packageinfo, false);
//                        if(l1 != null && a(list, l1))
//                            list.add(l1);
//                    }
//                    j1++;
//                }
//            }
//        }
//          goto _L1
    }

    private boolean a(List list, cls_l l1)
    {
//        if(list != null && l1 != null) goto _L2; else goto _L1
//_L1:
//        boolean flag = false;
//_L4:
//        return flag;
//_L2:
//        for(Iterator iterator = list.iterator(); iterator.hasNext();)
//        {
//            l l2 = (l)iterator.next();
//            if(l2.b().trim().equals(l1.b().trim()) && l2.d().trim().compareToIgnoreCase(l1.d().trim()) >= 0)
//            {
//                flag = false;
//                continue; /* Loop/switch isn't completed */
//            }
//        }
//
//        flag = true;
//        if(true) goto _L4; else goto _L3
//_L3:
    	return false;
    }

    private void b()
    {
        m = new cls_c(this);
        l = new ArrayList();
        k = new cls_dm(this, this, 0x7f03000d, l);
        j.setAdapter(k);
    }

    private void b(com.nnee.p_fk.cls_l l1)
    {
        if(l1 != null)
        {
            a(l1);
            f();
        }
    }

    static void b(cls_SetSkinActivity setskinactivity)
    {
        setskinactivity.f();
    }

    static void b(cls_SetSkinActivity setskinactivity, com.nnee.p_fk.cls_l l1)
    {
        setskinactivity.b(l1);
    }

    private void c()
    {
        j = (ListView)findViewById(0x102000a);
        j.setOnItemClickListener(r);
    }

    private void e()
    {
        LinearLayout _tmp = (LinearLayout)findViewById(0x7f0d0053);
    }

    private void f()
    {
//        l.clear();
//        a(l);
//        a(l, (new StringBuilder()).append(Environment.getExternalStorageDirectory()).append("/download/").toString());
//        l.add(cls_PrisApp.a().B());
//        l.add(new cls_l());
//        k.notifyDataSetChanged();
    }

    public void f_()
    {
        e();
    }

    public void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        setContentView(0x7f030019);
        c();
        b();
        e();
        o = new IntentFilter();
        o.addAction("android.intent.action.PACKAGE_ADDED");
        o.addAction("android.intent.action.PACKAGE_REMOVED");
        o.addDataScheme("package");
        p = getPackageName();
//        q = com.nnee.p_fk.cls_k.a(this);
    }

    public void onPause()
    {
//        super.onPause();
//        unregisterReceiver(m);
    }

    public void onResume()
    {
//        super.onResume();
//        f();
//        registerReceiver(m, o);
    }

    public static int a = 0;
    public static int b = 0;
    public static int c = 0;
    public static int d = 0;
    public static int e = 0;
    public static final String f = "set_skin_activity";
    private static final String h = "SetSkinActivity";
    private static final String i = "/download/";
    public Runnable g;
    private ListView j;
    private cls_dm k;
    private List l;
    private cls_c m;
    private Uri n;
    private IntentFilter o;
    private String p;
    private cls_k q;
    private cls_bx r;

    static 
    {
        a = 1;
        b = 2;
        c = 4;
        d = 8;
        e = 16;
    }
}
